
clear

cd "T:\Rtp.Bios\Studies\consults\SField\c562_EDUCO_closing\data\"

use final_dat




graph box lg_advance_rate [pweight = w], over(year)




matrix input results = ///
(1,1,0,0,0 \ ///
1,2,0,0,0 \ ///
1,3,0,0,0 \ ///
2,1,0,0,0 \ ///
2,2,0,0,0 \ ///
2,3,0,0,0 \ ///
3,1,0,0,0 \ ///
3,2,0,0,0 \ ///
3,3,0,0,0 \ ///
4,1,0,0,0 \ ///
4,2,0,0,0 \ ///
4,3,0,0,0 \ ///
5,1,0,0,0 \ ///
5,2,0,0,0 \ ///
5,3,0,0,0 ) ///





xtmixed lg_advance_rate educo time1 time2   ///
EDUCO_time1 EDUCO_time2 ///
if grade_num==1 ///
|| school_id:time1, cov(un) pw(w) residuals(ar 1,t(time)) 


/* impact */
lincom -3*EDUCO_time1 + 3*EDUCO_time2


/* start: EDUCO */
lincom  _cons + educo
mat results[1,3] = r(estimate)
mat results[1,4] = r(estimate)


/* time2 : EDUCO */
lincom  _cons + educo + time1*5 + EDUCO_time1*5
mat results[2,3] = r(estimate)
mat results[2,4] = r(estimate)

/* end : EDUCO  */
lincom  _cons + educo+ time1*5 + EDUCO_time1*5 + time2*3 + EDUCO_time2*3 
mat results[3,3] = r(estimate)


/* end : CF */
lincom  _cons + educo+ time1*5 + EDUCO_time1*5 + EDUCO_time1*3 + time2*3 
mat results[3,4] = r(estimate)


/* start: comparison*/
lincom  _cons 
mat results[1,5] = r(estimate)


/* time2 : comparison */
lincom  _cons + time1*5 
mat results[2,5] = r(estimate)

/* end : comparison  */
lincom  _cons + time1*5 +  time2*3 
mat results[3,5] = r(estimate)






xtmixed lg_advance_rate educo time1 time2   ///
EDUCO_time1 EDUCO_time2 ///
if grade_num==2 ///
|| school_id:time1, cov(un) pw(w) residuals(ar 1,t(time)) 


/* impact */
lincom -3*EDUCO_time1 + 3*EDUCO_time2


/* start: EDUCO */
lincom  _cons + educo
mat results[4,3] = r(estimate)
mat results[4,4] = r(estimate)


/* time2 : EDUCO */
lincom  _cons + educo + time1*5 + EDUCO_time1*5
mat results[5,3] = r(estimate)
mat results[5,4] = r(estimate)

/* end : EDUCO  */
lincom  _cons + educo+ time1*5 + EDUCO_time1*5 + time2*3 + EDUCO_time2*3 
mat results[6,3] = r(estimate)


/* end : CF */
lincom  _cons + educo+ time1*5 + EDUCO_time1*5 + EDUCO_time1*3 + time2*3 
mat results[6,4] = r(estimate)


/* start: comparison*/
lincom  _cons 
mat results[4,5] = r(estimate)


/* time2 : comparison */
lincom  _cons + time1*5 
mat results[5,5] = r(estimate)

/* end : comparison  */
lincom  _cons + time1*5 +  time2*3 
mat results[6,5] = r(estimate)







xtmixed lg_advance_rate educo time1 time2   ///
EDUCO_time1 EDUCO_time2 ///
if grade_num==3 ///
|| school_id:time1, cov(un) pw(w) residuals(ar 1,t(time)) 


/* impact */
lincom -3*EDUCO_time1 + 3*EDUCO_time2


/* start: EDUCO */
lincom  _cons + educo
mat results[7,3] = r(estimate)
mat results[7,4] = r(estimate)


/* time2 : EDUCO */
lincom  _cons + educo + time1*5 + EDUCO_time1*5
mat results[8,3] = r(estimate)
mat results[8,4] = r(estimate)

/* end : EDUCO  */
lincom  _cons + educo+ time1*5 + EDUCO_time1*5 + time2*3 + EDUCO_time2*3 
mat results[9,3] = r(estimate)


/* end : CF */
lincom  _cons + educo+ time1*5 + EDUCO_time1*5 + EDUCO_time1*3 + time2*3 
mat results[9,4] = r(estimate)


/* start: comparison*/
lincom  _cons 
mat results[7,5] = r(estimate)


/* time2 : comparison */
lincom  _cons + time1*5 
mat results[8,5] = r(estimate)

/* end : comparison  */
lincom  _cons + time1*5 +  time2*3 
mat results[9,5] = r(estimate)















xtmixed lg_advance_rate educo time1 time2   ///
EDUCO_time1 EDUCO_time2 ///
if grade_num==4 ///
|| school_id:time1, cov(un) pw(w) residuals(ar 1,t(time)) 


/* impact */
lincom -3*EDUCO_time1 + 3*EDUCO_time2


/* start: EDUCO */
lincom  _cons + educo
mat results[10,3] = r(estimate)
mat results[10,4] = r(estimate)


/* time2 : EDUCO */
lincom  _cons + educo + time1*5 + EDUCO_time1*5
mat results[11,3] = r(estimate)
mat results[11,4] = r(estimate)

/* end : EDUCO  */
lincom  _cons + educo+ time1*5 + EDUCO_time1*5 + time2*3 + EDUCO_time2*3 
mat results[12,3] = r(estimate)


/* end : CF */
lincom  _cons + educo+ time1*5 + EDUCO_time1*5 + EDUCO_time1*3 + time2*3 
mat results[12,4] = r(estimate)


/* start: comparison*/
lincom  _cons 
mat results[10,5] = r(estimate)


/* time2 : comparison */
lincom  _cons + time1*5 
mat results[11,5] = r(estimate)

/* end : comparison  */
lincom  _cons + time1*5 +  time2*3 
mat results[12,5] = r(estimate)








xtmixed lg_advance_rate educo time1 time2   ///
EDUCO_time1 EDUCO_time2 ///
if grade_num==5 ///
|| school_id:time1, cov(un) pw(w) residuals(ar 1,t(time)) 


/* impact */
lincom -3*EDUCO_time1 + 3*EDUCO_time2


/* start: EDUCO */
lincom  _cons + educo
mat results[13,3] = r(estimate)
mat results[13,4] = r(estimate)


/* time2 : EDUCO */
lincom  _cons + educo + time1*5 + EDUCO_time1*5
mat results[14,3] = r(estimate)
mat results[14,4] = r(estimate)

/* end : EDUCO  */
lincom  _cons + educo+ time1*5 + EDUCO_time1*5 + time2*3 + EDUCO_time2*3 
mat results[15,3] = r(estimate)


/* end : CF */
lincom  _cons + educo+ time1*5 + EDUCO_time1*5 + EDUCO_time1*3 + time2*3 
mat results[15,4] = r(estimate)


/* start: comparison*/
lincom  _cons 
mat results[13,5] = r(estimate)


/* time2 : comparison */
lincom  _cons + time1*5 
mat results[14,5] = r(estimate)

/* end : comparison  */
lincom  _cons + time1*5 +  time2*3 
mat results[15,5] = r(estimate)


save results



